{% extends "stories/base.html" %}
{% load i18n %}

{% block head_title %}Story List{% endblock %}

{% block subnav %}
    <h2>{% trans "Links" %}</h2>
    <ul class="action-links">
        <li><a href="{% url stories_add_story %}" title="Add Story">Add Story</a></li>
    </ul>
{% endblock %}

{% block main_content %}
    <h1>Stories</h1>

    {% if stories %}
        <table cellspacing="0" cellpadding="0" class="list-table">
        <thead>
            <tr>
                <th class="id_col">Id</th>
                <th>Title</th>
                <th>Media</th>
                <th class="count_col">Pages</th>
                <th class="status_col">Status</th>
                <th>Modified</th>
            </tr>
        </thead>
        {% for story in stories %}
        <tr class="{% cycle '' 'alt-row' %}">
            <td class="id_col">{{ story.id }}</td>
            <td><a href="{% url stories_story_pages story.id %}">{{ story.headline }}</a></td>
            <td>
            <a href="{% url stories_story_media story.id %}">media list</a>
            </td>
            <td class="count-col">
            {% for p in story.pages %}
            <a href="{% url stories_story_pages story.id %}?page={{ p.id }}">{{ p.pagenum }}</a>
            {% endfor %}
            <td class="status-col">{{ story.get_status_display }}</td>
            <td>{{ story.modified|date:"fa F jS, Y" }}</td>
        </tr>
        {% endfor %}
        </table>
    {% else %}
    <p>You haven't created any stories yet.</p>
    {% endif %}

{% endblock %}
